Jump to content

Recommended Posts

I've fixed the issue.

 

As a part of my mod, I'm adding a steam-powered robot as a follower. He does emit steam ever now and then, but I haven't been able to add sound when he emits steam. And it's currently coming out of his foot.

If anyone could tell me how to position the steam and add sounds, I would be very grateful.

 

 

 Here's the coding for the steam:

 

    inst:AddComponent("periodicspawner")
    inst.components.periodicspawner:SetPrefab("poopcloud")
    inst.components.periodicspawner:SetRandomTimes(5, 15)
    inst.components.periodicspawner:SetDensityInRange(20, 2)
    inst.components.periodicspawner:SetMinimumSpacing(0.1)
    inst.components.periodicspawner:Start()

 

I set it to play the sound and emit the smoke when I feed him gears.

http://www.youtube.com/watch?v=YudCvlVAELw&feature=youtu.be

 

Thank you.

I also noticed the typo on the forum title. Didn't notice untill I'd hit post.

Edited by Mr. Tiddles
  • Developer

As a part of my mod, I'm adding a steam-powered robot as a follower. He does emit steam ever now and then, but I haven't been able to add sound when he emits steam. And it's currently coming out of his foot.

If anyone could tell me how to position the steam and add sounds, I would be very grateful.

 

 Here's the coding for the steam:

 

    inst:AddComponent("periodicspawner")

    inst.components.periodicspawner:SetPrefab("poopcloud")

    inst.components.periodicspawner:SetRandomTimes(5, 15)

    inst.components.periodicspawner:SetDensityInRange(20, 2)

    inst.components.periodicspawner:SetMinimumSpacing(0.1)

    inst.components.periodicspawner:Start()

 

I set it to play the sound and emit the smoke when I feed him gears.

http://www.youtube.com/watch?v=YudCvlVAELw&feature=youtu.be

 

Thank you.

I also noticed the typo on the forum title. Didn't notice untill I'd hit post.

Could you please upload your mod?  It makes it much easier to help you out :).

I couldn't exactly make it randomly happen but I could make it so he emits the smoke/sound whenever performing an action with a few simple commands in the Setgraph. I only set it to whenever he triggered the "run_start" state, which works very well; not spamming smoke everywhere, but activating only when he begins running and during the short stops during running.

 

Here's the state with the smoke. The bold/underlined text is the added coding.

 

State{
        name = "run_start",
        tags = {"moving", "running", "canrotate"},
        
        onenter = function(inst)
            inst.components.locomotor:RunForward()
            inst.AnimState:PlayAnimation("run_pre")
            inst.sg.mem.foosteps = 0
        end,

        onupdate = function(inst)
            inst.components.locomotor:RunForward()
        end,

        events=
        {   
            EventHandler("animover", function(inst) inst.sg:GoToState("run") end ),        
        },
        
        timeline=
        {        
            TimeEvent(4*FRAMES, function(inst)
            local pos = Vector3(inst.Transform:GetWorldPosition())
            pos.y = pos.y + 1 + math.random()*1.5
            local cloud = SpawnPrefab("poopcloud")
            cloud.Transform:SetPosition(pos:Get())
                inst.SoundEmitter:PlaySound("dontstarve/creatures/rook/steam")

            end),
        },        
        
    },
 

Not very specific, I know.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...